<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="common/common_head :: commonHeader('编辑供应商月度评估信息')"/>
    <link th:href="@{/css/plugins/datapicker/datepicker3.css}" rel="stylesheet">
</head>

<body class="gray-bg">

<div class="wrapper wrapper-content animated fadeInRight">
    <form class="form-horizontal" method="post" id="ssessForm">
        <div class="row">
            <div class="form-group">
                <div class="col-sm-8" style="margin-left: 16px">
                    <input class="btn btn-primary" type="button" onclick="save()" value="保存">
                    <button class="btn btn-primary" type="button" onclick="Dialog.closeFrame(window.name)">取 消</button>
                </div>
            </div>
            <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>供应商月度评估</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="form-group">
                            <label class="col-xs-1 control-label"><span class="required-sign">*</span>供应商编码：</label>
                            <div class="col-xs-3">
                                <input name="markId" th:value="${ssessEntity.markId}" readonly="readonly" type="hidden" />
                                <input name="vendorCode" th:value="${ssessEntity.vendorCode}" readonly="readonly" type="text" placeholder="供应商编码" class="form-control"/>
                            </div>
                            <label class="col-xs-1 control-label">供应商名称：</label>
                            <div class="col-xs-3">
                            	<input name="vendorName" th:value="${ssessEntity.vendorName}" readonly="readonly" type="text" placeholder="供应商名称" class="form-control"/>
                            </div>
                            <div class="form-group">
                            <label class="col-xs-1 control-label">价格分</label>
                            <div class="col-xs-3">
                            	<input name="priceMark" th:value="${ssessEntity.priceMark}" readonly="readonly" type="text" placeholder="价格分" class="form-control"/>
                            </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">交期评分：</label>
                            <div class="col-sm-3">
                                <input id="deliveryTimeMark" name="deliveryTimeMark" th:value="${ssessEntity.deliveryTimeMark}" readonly="readonly" type="text" placeholder="交期评分" class="form-control" />
                            </div>
                            <label class="col-sm-1 control-label">品质评分：</label>
                            <div class="col-sm-3">
                                <input onchange="change('qualityMark')" id="qualityMark" name="qualityMark" th:value="${ssessEntity.qualityMark}" min="0" max="60" type="number" oninput="if(value>60) value=60 if(value<0)value=0" placeholder="品质评分" class="form-control">
                            </div>
                            <label class="col-sm-1 control-label">服务评分：</label>
                            <div class="col-sm-3">
                                <input onchange="change('serviceMark')" id="serviceMark" name="serviceMark" th:value="${ssessEntity.serviceMark}" min="0" max="10" type="number" oninput="if(value>10) value=10 if(value<0)value=0" placeholder="服务评分" class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">备注：</label>
                            <div class="col-sm-3">
                                <input name="remark" th:value="${ssessEntity.remark}" type="text" placeholder="备注" class="form-control">
                            </div>
                        </div>
                    </div>
                </div>
       </div>
   </form>
 </div>
<!--引入公共js-->
<div th:include="common/onload_js :: onloadJS"></div>
<!-- Chosen -->
<script th:src="@{/static/js/plugins/chosen/chosen.jquery.js}"></script>
<script type="text/javascript">
    
     //控制输入数字的大小
    function change(id) {
      //得到输入的值
      var str= $("#qualityMark").val();
      var str1= $("#serviceMark").val();
      if(id=="qualityMark"){
    	  if(str>60){
  	    	  alert("请输入小于待发货的量");
  	    	  $("#qualityMark").val("");
	  	  }
	  	  if(str<0){
	  	    	  alert("请输入正确的发货量");
	  	    	  $("#qualityMark").val("");
	  	  }
      }
      if(id=="serviceMark"){
    	  if(str1>10){
        	  alert("请输入小于待发货的量");
        	  $("#serviceMark").val("");
    	  }
    	  if(str1<0){
    	    	  alert("请输入正确的发货量");
    	    	  $("#serviceMark").val("");
    	  }
      }
    }
    //保存
	function save() {
	    if($("#ssessForm").valid()) {
	        Page.ajaxPOST(ctxPath + "/ssess/update", $('#ssessForm').serialize(), function (res) {
	            Dialog.msg("月度评估更新成功!",function(){
	            	parent.refresh();
	                Dialog.closeFrame(window.name);
	            });
	        });
	    }
	}
</script>

</body>
</html>
